﻿using System;
using System.Windows.Data;
using Facebook.Service;

namespace FacebookPhotosLiveWriterPlugin.Converters
{
    public class PhotoIDToImageUrlConverter : IValueConverter
    {

        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value.ToString() != "0")
            {
                Photo photo = FacebookPlugin.Service.Photos.GetPhoto(value.ToString());
                return photo.ImageUrl;
            }
            return "http://static.ak.facebook.com//pics/s_default.jpg";

        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
